package Card;

public class Card {
    public static enum Flush {
        HEART(0),
        SPADE(1),
        DIAMOND(2),
        CLUB(3),
        JOKER(4);

        private int value;

        Flush(int value) {
            this.value = value;
        }

        public int getValue() {
            return this.value;
        }

        public static Flush fromValue(int value) {
            for (Flush f : Flush.values())
                if (f.getValue() == value)
                    return f;
            throw new RuntimeException("Unknown flush");
        }
    }

    private Flush flush;
    private int number;

    public Card(Flush flush, int number) {
        this.flush = flush;
        this.number = number;
    }

    public Flush getFlush() {
        return this.flush;
    }

    public int getNumber() {
        return this.number;
    }

    @Override
    public String toString() {
        return this.flush + " : " + this.number;
    }
}
